<?php

/**
 * KTDCharacterFiche form.
 *
 * @package    s-test
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class KTDCharacterFicheForm extends BaseKTDCharacterFicheForm
{
  public function configure()
  {
      $this->disableLocalCSRFProtection();
      
      $this->setWidgets(array(
        'first_name' => new sfWidgetFormInputText(array(
            'label' => 'Prénom'
            )),
        'name'       => new sfWidgetFormInputText(array(
            'label' => 'Nom'
        )),
        'age'        => new sfWidgetFormInputText(array(
            'label' => 'Âge'
        )),
        'race'        => new sfWidgetFormInputText(array(
            'label' => 'Race'
        )),
        'story'      => new sfWidgetFormKTDTextarea(array(
            'label' => 'Histoire'
        ), array("class"=>"accordion-textarea")),
        'mind_desc'  => new sfWidgetFormKTDTextarea(array(
            'label' => 'Psychologie'
        )),
        'phy_desc'   => new sfWidgetFormKTDTextarea(array(
            'label' => 'Apparence'
        )),
        'pnj'        => new sfWidgetFormKTDTextarea(array(
            'label' => 'PNJ'
        )),
        'other'      => new sfWidgetFormKTDTextarea(array(
            'label' => 'Autres'
        )),
        'alignement' => new sfWidgetFormSelect(array(
            'label' => 'Alignement',
            'choices'=> KTDCharacter::$alignements
        )),
      ));
      $this->setValidators(array(
        'first_name'    => new sfValidatorString(array('required'   =>  false)),
        'name'          => new sfValidatorString(array('required'   =>  false)),
        'age'           => new sfValidatorString(array('required'   =>  false)),
        'race'           => new sfValidatorString(array('required'   => false)),
        'story'         => new sfValidatorString(array('required'   =>  true), array("required"=>"requis")),
        'mind_desc'     => new sfValidatorString(array('required'   =>  true), array("required"=>"requis")),
        'phy_desc'      => new sfValidatorString(array('required'   =>  true), array("required"=>"requis")),
        'other'         => new sfValidatorString(array('required'   =>  false)),
        'pnj'           => new sfValidatorString(array('required'   =>  false)),
        'alignement'    => new sfValidatorChoice(array('choices'    => array_keys(KTDCharacter::$alignements))),
        
      ));
      $this->widgetSchema->setNameFormat("ktd_character_fiche[%s]");
  }
}
